package com.ayu.scalalearn.chapter07

import scala.collection.immutable.Queue
import scala.collection.mutable

/**
  * @Author 徐林玉
  * @Description Test10Queue
  * @Date 2022/8/16 16:36
  * @Version 1.0
  */
object Test10Queue {

  def main(args: Array[String]): Unit = {
    //1、创建一个可变队列
    var queue: mutable.Queue[String] = new mutable.Queue[String]()
    //入队
    queue.enqueue("a","b","c")
    println(queue)
    //出队
    println(queue.dequeue())
    println(queue)

    queue.enqueue("d","e")
    println(queue)


    //不可变队列
    val queue2: Queue[String] = Queue("a", "b", "c")
    val queue3 = queue2.enqueue("d")
    println(queue2)
    println(queue3)
  }

}
